package cn.ecasoft;

import cn.ecasoft.service.SocketServer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
import org.springframework.web.client.RestTemplate;

import static cn.ecasoft.util.SpringUtil.getBean;

@EnableDiscoveryClient
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
public class DataexchangeApplication {

    public static void main(String[] args) {
//        System.setProperty(ClientLogger.CLIENT_LOG_USESLF4J,"true");
        SpringApplication.run(DataexchangeApplication.class, args);
        getBean(SocketServer.class).start();
    }

    @Bean
    @LoadBalanced
    public RestTemplate loadBalanced1() {
        return new RestTemplate();
    }
    @Bean
    @Primary
    public RestTemplate creatRestTemplate() {
        return new RestTemplate();
    }
}
